package com.noahplat.user.mapper;

import com.noahplat.user.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * 用户表关系映射
 * <p>
 * 作者：李景星
 * 描述：用户mapper
 * 时间：2020-10-31
 */
public interface UserMapper extends Mapper<User> {

    @Select("select u.id,u.stid,u.acctid,u.username,u.name,u.phone,u.created_time as createdTime,u.del," +
            "t.sys_name as sysname,a.acctname as accountname from tb_user u left join sys_type t on t.id = u.stid " +
            " left join tb_account a on a.id = u.acctid where u.user_pro=#{userPro}")
    List<User> selectUserByUserPro(@Param("userPro") String userPro);

    @Select("select u.id,u.stid,u.acctid,u.username,u.name,u.phone,u.created_time as createdTime,u.del," +
            " t.sys_name as sysname,a.acctname as accountname from tb_user u left join sys_type t on t.id = u.stid " +
            " left join tb_account a on a.id = u.acctid where u.stid=#{stid} and u.user_pro=#{userPro}")
    List<User> selectUserByUserProAndStid(@Param("userPro") String userPro, @Param("stid") Long stid);
}
